//
//  Me2DayAttach.m
//  CairnStory
//  www.cairnstory.com
//
//  Created by saturna on 11. 3. 18..
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "Me2DayAttach.h"
#import "Me2DayUtil.h"


#pragma mark -
#pragma mark Me2DayAttach

@implementation Me2DayAttach

@synthesize fileName = m_fileName;
@synthesize contentType = m_contentType;
@synthesize attachData = m_attachData;


- (void)dealloc
{
	[m_fileName release];
	[m_contentType release];
	[m_attachData release];

	[super dealloc];
}

- (id)initWithAttachData:(NSData*)attachData
			 andFileName:(NSString*)fileName
		  andContentType:(NSString*)contentType
{
	self = [super init];
	if (self == nil)
	{
		return self;
	}

	m_attachData = [attachData retain];
	m_fileName = [fileName retain];
	if (EmptyString(contentType))
	{
		m_contentType = [GetMimeType(m_fileName) retain];
	}
	else
	{
		m_contentType = [contentType retain];
	}

	return self;
}


- (id)initWithAttachData:(NSData*)attachData
			 andFileName:(NSString*)fileName
{
	return [self initWithAttachData:attachData
						andFileName:fileName
					 andContentType:nil];
}


@end


